void reverse(char* start_p, char* endn_p) {
	while (1) {
		endn_p--;
		if ((start_p >= endn_p)) {
			return;
		}
		unsigned ch = *start_p;
		*start_p = *endn_p;
		*endn_p = ch;
		start_p++;
	}
}

// 去除多余空格、将每个单词翻转，返回endn指针。
char* delete_space_reverse_word(char str_b[]) {
	const char* read_p = str_b;
	char* write_p = str_b;
	char* word_start_p;
	char* word_endn_p;
	while (1) {
		unsigned ch;
		while (1) {
			ch = *read_p;
			if (ch == '\0') {
				// 如果已经有单词，此时末尾是空格，应去除。
				if (write_p != str_b) {
					write_p--;
				}
				return write_p;
			} else if (ch != ' ') {
				break;
			}
			read_p++;
		}
		word_start_p = write_p;
		while (1) {
			*write_p = ch;
			read_p++;
			write_p++;
			ch = *read_p;
			if (ch == '\0') {
				reverse(word_start_p, write_p);
				return write_p;
			} else if (ch == ' ') {
				break;
			}
		}
		*write_p = ch;
		word_endn_p = write_p;
		read_p++;
		write_p++;
		reverse(word_start_p, word_endn_p);
	}
}

char* reverseWords(char str_b[]) {
	char* endn_p = delete_space_reverse_word(str_b);
	*endn_p = '\0';
	reverse(str_b, endn_p);
	return str_b;
}